<?php include_stylesheets_for_form($form) ?>
<?php include_javascripts_for_form($form) ?>

<form id="form_categoria" action="<?php echo url_for('categoria/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id_categoria='.$form->getObject()->getIdCategoria() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<input type="hidden" name="id_categoria" value="<?php echo $form->getObject()->getIdCategoria() ?>" />
<?php endif; ?>
	<?php echo $form->renderHiddenFields() ?>
<table class="form">
	<tbody>
		<tr>
			<th colspan="2" class="title">Dados categoria</th>
		</tr>
		<?php echo $form->renderGlobalErrors() ?>
		<tr>
			<th><?php echo $form['nm_categoria']->renderLabel() ?></th>
			<td><?php echo $form['nm_categoria'] ?> <?php echo form_error('categoria[nm_categoria]'); ?></td>
		</tr>
		<tr>
			<th><?php echo $form['ds_categoria']->renderLabel() ?></th>
			<td><?php echo $form['ds_categoria'] ?> <?php echo form_error('categoria[ds_categoria]'); ?></td>
		</tr>
		<tr>
			<th><?php echo $form['id_categoria_pai']->renderLabel() ?></th>
			<td><?php echo $form['id_categoria_pai'] ?> <?php echo form_error('categoria[id_categoria_pai]'); ?></td>
		</tr>
		<tr>
			<th><?php echo $form['tipo_list']->renderLabel() ?></th>
			<td><?php echo $form['tipo_list'] ?> <?php echo form_error('categoria[tipo_list]'); ?></td>
		</tr>
	</tbody>
</table>
</form>

<?php
	comandos_form(
		link_to(
			':: Listar ::',
			'categoria/list',
			array('class' => 'botao')
		),
		button_to_function(
			':: Salvar ::',
			"$('#form_categoria').submit()",
			array('class' => 'botao')
		)
	);
?>